home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5254 < prev    next >
Encoding:
Text File  |  1996-08-05  |  970 b   |  42 lines

  1. Path: news.ust.hk!cckwwma
  2. From: cckwwma@uxmail.ust.hk (Wallace Ma)
  3. Newsgroups: comp.lang.c
  4. Subject: stdlib problem
  5. Date: 9 Feb 1996 10:09:24 GMT
  6. Organization: The Hong Kong University of Science and Technology
  7. Message-ID: <4ff6gk$ak2@news.ust.hk>
  8. NNTP-Posting-Host: ustsu3.ust.hk
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Hi there,
  12.     
  13.     When I run the following program using borland c++, I got the correct
  14. result. However, when I run it on SunOS 4.1.3 with C or C++ SparcCompiler
  15. v2.0 or 3.0, it couldn't get the data type ldiv_t in stdlib.h.
  16. Does anybody know is the data type ldiv_t defined and function ldiv
  17. can be found on the stdlib.h in SparcCompiler?
  18.  
  19. thanks in advance....
  20. -Wallace
  21.  
  22. ==================
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <math.h>
  26. #include <limits.h>
  27.  
  28.  
  29. main()
  30. {
  31.  
  32. long a, b;
  33. ldiv_t result;
  34.  
  35.         a=13;
  36.         b=3;
  37.         result = ldiv(a,b);
  38.         printf("quotine=%1d\tremainder=%1d\n", result.quot, result.rem);
  39.  
  40. }
  41. ==================
  42.